package xyf.p04.tree;

import commons.TreeNode;

/**
 * ClassName: P0226_Reverse
 * Description:
 * Author: xyf
 * Date: 9/7/22 10:06 PM
 * Version: 1.0
 **/
public class P0226_Reverse
{
    public TreeNode invertTree(TreeNode root)
    {
        if (root == null)
        {
            return null;
        }

        TreeNode left = invertTree(root.left);
        TreeNode right = invertTree(root.right);

        root.left = right;
        root.right = left;
        return root;
    }
}
